package cc.linker.steplink.crm.merchant.dao;

import cc.linker.steplink.crm.merchant.pojo.PersonnelReadDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public interface PersonnelDao {
    List<Map<String, Object>> getList(Map<String, String> map);

    void del(long authorId);

    /**
     * 微信关注之后，更新open_id和customer_id信息
     *
     * @param map
     * @return
     */
    int updateWxSubscribeData(Map<String, Object> map);

    //添加发送邮件列表
    void addEmailTask(Map<String, Object> map);

    //根据TaskID获取发送成功的邮件数量
    Integer getSuccessCountByTaskId(String taskId);

    //根据TaskID更新触达数量
    void updateSuccessCountByTaskId(@Param("num") Integer num,@Param("taskId") String taskId);

    //根据更新原有业务表触达数量
    void updatePreciseList(@Param("num") Integer num,@Param("taskId") String taskId);

    //更新邮件任务状态
    void updateEmailStatus(Map<String, Object> map);

    //更新邮件任务状态
    void updateEmailStatusByOpenId(Map<String, Object> map);

    //根据微信用户OpenId找到 邮件状态跟踪表的ids
    List<String> getPrecisePidsByOpenId(String openId);

    List<String> getDomainList(String orgId);

    void addCustomer(Map<String, Object> da);

    void addAuthorCustomer(Map<String, Object> da);

    int getCustomerCount(String orgId);

    Map<String, Object> getDetail(String authorId);

    List<Map<String, Object>> getReadInfoIdByEmail(String email);

    void saveRemark(@Param("authorId") String authorId, @Param("remark") String remark);

    int getPidByEmailAndTaskId(Map<String, Object> map);

    void addReadLog(Map<String, Object> map);

    void addWxCancelReadLog(List<Map<String, Object>> list);


    //查询时间和阅读数的关系
    List<PersonnelReadDTO> readResultList();

    //查询推送成功的数量
    String sendSuccessCount();

    //查询全部推送的数量
    String allSendCount();

    // 按照用户类型进行分组统计
    List<Map<String, String>> selectPersonelCountByType(Map<String, String> map);

    // 根据用户类型查询邮件列表
    List<String> selectPersonelEmailListByType(Map<String, Object> map);

    List<Map<String, String>> pushReport();

}
